<?php

/** 
* 
* 
* by:南宁火蝶科技有限公司 http:///www.HdsysCms.com
* 声明:本系统禁止用二次开发、侵犯HdsysCms著作和除去HdsysCms进行售卖,如发现将追究一切权利,模版制作属于自己所得可以通过本系统对外开发模版获取收益!
* 
* 2019年第一版本发布 - 到2023.9.1开源使用! 
* php混淆工具:phpencry.wbox.top
* 
* 注意防骗:@HdsysCms 官方没授权任何个人机构合作,唯一收款抬头:《南宁火蝶科技有限公司》和官网显示客服唯一渠道客服,其它渠道以HdsysCms名义行为均骗子!
*
*/
	

defined('HDSYS_SET') or call_my_die("" . 'Not,This File Not Can in Ie Open');
if (HDSYS_SET !='ADMIN') {
call_my_die("" . '访问路径错误');
}
class Hdsys
{
private $intelligence_session,$intelligence_db,$purconfig;
public function __construct()
{
$this->intelligence_session=bs_lib::load_libhdsys_class("" . 'session');
$this->intelligence_session->intelligence_session_open();
$this->intelligence_db=bs_lib::load_libhdsys_class(templates_Verifications_db());
$this->purconfig=bs_lib::load_libhdsys_class('purconfig');
bs_lib::load_modules_common();
isadminlogin();
}
public function call_phpinfo()
{
phpinfo();
}
public function call_replace()
{
$param_key=time();
$param_md5=md5($_SERVER['DOCUMENT_ROOT'] . $param_key);
setcookie('key', $param_key, 0, '/');
$param_sha1_token=sha1(sha1($param_key . DBSQLTYPE . DBSQLITEFILE . DBHOST . DBUSER . DBPASS . DBTABLE . DBQIANHUAN . 'hdsyscms'));
include bs_lib::load_default_path();
}
public function call_setup()
{
include bs_lib::load_default_path();
}
public function call_setup_ajax()
{
$param_array=set_post();
$set_name=set_post("" . 'set_name');
$bool=$this->purconfig->pur_configs($set_name, $param_array);
if ($bool) {
print_json(array(call_my_str_code()=> call_my_int_1(), call_my_str_msg()=> "保存成功!"));
} else {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> "保存失败,请确认缓存目录【cache】写入权限!"));
}
}
public function call_cache()
{
$param_dir=HDSYS_DIR_SYS . 'cache';
$param_dir_list=read_dir($param_dir);
$showinfo='';
foreach ($param_dir_list as $param_file) {
$param_file_show=str_replace(HDSYS_DIR_SYS, '@', $param_file);
if (is_file($param_file)) {
if (unlink($param_file)) {
$showinfo .='<p class="c a1">' . $param_file_show . '  缓存清理成功</p>';
} else {
$showinfo .='<p class="c a2>' . $param_file_show . '  缓存清理失败,查看目录【cache】权限是否777</p>';
}
} else {
$showinfo .='<p class="c a3>' . $param_file_show . '  不存在,缓存已清理</p>';
}
}
$showinfo .='<p class="c a1">缓存信息清理完成！</p>';
include bs_lib::load_default_path();
}
public function intelligence_is_adimges($param_name)
{
$param_trues=true;
$param_dir=HDSYS_DIR_SYS . 'templates/' . bs_lib::get_configs_value('template', 'current') . '/modular';
$param_dir_list=read_dir($param_dir);
$showinfo='';
$param_while_array_list_all=array();
$param_tmp_rows=0;
$param_dir=HDSYS_DIR_SYS . 'templates/' . bs_lib::get_configs_value('template', 'current') . '/modular';
foreach ($param_dir_list as $param_file) {
$param_file_show=str_replace($param_dir . '/', '', $param_file);
if (is_file($param_file)) {
$param_tmp_rows++;
$param_filetxt=file_get_contents($param_file);
if (stripos($param_filetxt, $param_name) > 0) {
$param_trues=true;
break;
} else {
$param_trues=false;
}
} else {
}
}
return $param_trues;
}
public function call_logut()
{
set_session_value('admin_id', 0);
set_session_value('admin_user', '');
set_session_value('admin_md5', '');
call_my_locationindex();
}
public function call_info()
{
$__SERVER__=call_my_SERVER();
$param_dir=$__SERVER__["" . 'HTTP_HOST'] . call_my_str_replace($__SERVER__["" . 'DOCUMENT_ROOT'], '', HDSYS_DIR_SYS);
$param_dir=urlencode($param_dir);
$param_array_info_post=array("" . "v"=> HDSYS_VERSION, "" . "dir"=> $param_dir, "" . "host"=> $__SERVER__["" . 'HTTP_HOST'], "" . 'npc'=> MD5("" . '479e789a029e5f5b479e789a029e5f5b' . $__SERVER__["" . 'HTTP_HOST'] . "" . 'd64a14df5dc58453d64a14df5dc58453'));
$param_data=Bsphp_openssl_post(Bsphp_decrypt(call_my_base64_decode(Bsphp_HOST_SRE_Information)), $param_array_info_post);
$param_pizza=Bsphp_decrypt($param_data);
$param_pieces=explode("|", $param_pizza);
if ($param_pieces[0] !="" . "BsphpHTTP_pro") {
$param_pieces[1]="" . '获取失败';
$param_pieces[2]="" . '获取失败';
$param_pieces[3]="" . '获取失败';
$param_pieces[4]="" . '获取失败';
$param_pieces[5]="" . '获取失败';
$param_pieces[6]="" . '获取失败';
$param_pieces[7]="" . '获取失败';
$param_pieces[8]="" . '获取失败';
$param_pieces[9]="" . '获取失败';
$param_pieces[10]="" . '获取失败';
}
$param_bsphp_Users=$param_pieces[10];
include bs_lib::load_default_path();
}
public function call_user()
{
include bs_lib::load_default_path();
}
public function call_password()
{
$param_id=set_get('id');
$param_sql="SELECT * FROM `hdsys_admin` WHERE `hdsys_admin`.`id`='{$param_id}'";
$userarr=$this->intelligence_db->intelligence_array($param_sql);
if (!$userarr) {
call_my_die('帐号不存在');
}
include bs_lib::load_default_path();
}
public function call_password_ajax()
{
$param_id=set_post("" . 'id');
$password=set_post("" . 'password');
$param_sql="SELECT * FROM `hdsys_admin` WHERE `hdsys_admin`.`id`='{$param_id}' ";
$userarr=$this->intelligence_db->intelligence_array($param_sql);
if (!$userarr) {
call_my_die('帐号不存在');
}
$password=call_my_md5($password);
$param_sql="UPDATE `hdsys_admin` SET `password`='{$password}' WHERE `hdsys_admin`.`id`='{$param_id}' ;";
$param_tmp=$this->intelligence_db->intelligence_query($param_sql);
if ($param_tmp) {
print_json(array(call_my_str_code()=> call_my_int_1(), call_my_str_msg()=> '修改成功'));
} else {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> '修改失败'));
}
}
public function call_useradd()
{
include bs_lib::load_default_path();
}
public function call_useradd_ajax()
{
$username=strtolower(set_post("" . 'username'));
$password=set_post("" . 'password');
if ($username=='' and $password=='' ) {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> '信息不能空'));
}
$password=call_my_md5($password);
$param_sql=sprintf("SELECT * FROM `hdsys_admin` WHERE `username` Like \"%s\"; ", $username);
$userarr=$this->intelligence_db->intelligence_array($param_sql);
if ($userarr) {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> '当前帐号已经存在'));
}
$param_tmp=$this->intelligence_db->intelligence_insert('hdsys_admin', array('username'=> $username, 'password'=> $password, 'updatetime'=> HOST_DATE));
if ($param_tmp) {
print_json(array(call_my_str_code()=> call_my_int_1(), call_my_str_msg()=> '添加成功'));
} else {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> '添加失败'));
}
}
public function call_userdel_ajax()
{
$param_id=set_post("" . 'id');
if ($param_id==get_session_value('admin_id')) {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> '不能删除自己当前登录帐号'));
}
$param_sql="DELETE FROM `hdsys_admin` WHERE `hdsys_admin`.`id`='{$param_id}' ";
$param_tmp=$this->intelligence_db->intelligence_query($param_sql);
if ($param_tmp) {
print_json(array(call_my_str_code()=> call_my_int_1(), call_my_str_msg()=> '删除成功'));
} else {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> '删除失败'));
}
}
public function call_user_ajax()
{
$param_FANYE=(int)set_get('page');
if ($param_FANYE > 0) {
$param_db_ID=$param_FANYE - 1;
} else {
$param_db_ID=0;
$param_FANYE=1;
}
$param_shu=set_get('limit');
if ($param_shu==0) {
$param_shu=10;
}
$param_db_ID=$param_db_ID * $param_shu;
$param_soso=set_get('soso');
$param_soso_id=(int)set_get('soso_id');
$param_DESC_id=(int)set_get('DESC');
$param_soso_id > 0 ? $param_soso_id_show=$param_soso_id - 1 : $param_soso_id_show=0;
$param_DESC_id==1 ? $param_DESC='ASC' : $param_DESC='DESC';
$param_sql="SELECT*FROM`hdsys_admin`WHERE `username`LIKE '%{$param_soso}%' ORDER BY`id`{$param_DESC} LIMIT {$param_db_ID},{$param_shu}";
$param_db_array_value=$this->intelligence_db->intelligence_query($param_sql);
$param_tmp_rows="select count(*)as 'hangshu' from`hdsys_admin` WHERE `username`LIKE '%{$param_soso}%'";
$param_tmp_arr=$this->intelligence_db->intelligence_array($param_tmp_rows);
$param_tmp_rows=(int)$param_tmp_arr['hangshu'];
$param_while_array_list_all=array();
while ($param_value=$this->intelligence_db->intelligence_assoc($param_db_array_value)) {
$param_while_array_list_all[]=$param_value;
}
$param_json_array=array();
$param_json_array[call_my_str_data()]=(array) $param_while_array_list_all;
$param_json_array[call_my_str_code()]=0;
$param_json_array[call_my_str_msg()]='';
$param_json_array[call_my_str_count()]=$param_tmp_rows;
print_json($param_json_array);
}
}
